package com.yizhu.zczy.project.controller;

import java.util.Arrays;
import java.util.Map;


import com.yizhu.zczy.common.utils.PageUtils;
import com.yizhu.zczy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yizhu.zczy.project.entity.ItemDataEntity;
import com.yizhu.zczy.project.service.ItemDataService;




/**
 * 项目融资信息资料下载
 *
 * @author guoyz
 * @email guoyz@mail.com
 * @date 2021-06-24 17:33:48
 */
@RestController
@RequestMapping("project/itemdata")
public class ItemDataController {
    @Autowired
    private ItemDataService itemDataService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("project:itemdata:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = itemDataService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("project:itemdata:info")
    public R info(@PathVariable("id") Integer id){
		ItemDataEntity itemData = itemDataService.getById(id);

        return R.ok().put("itemData", itemData);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("project:itemdata:save")
    public R save(@RequestBody ItemDataEntity itemData){
		itemDataService.save(itemData);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("project:itemdata:update")
    public R update(@RequestBody ItemDataEntity itemData){
		itemDataService.updateById(itemData);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("project:itemdata:delete")
    public R delete(@RequestBody Integer[] ids){
		itemDataService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
